package com.itheima.demo1;

import java.lang.reflect.Method;
import java.util.ArrayList;

public class Demo {
    public static void main(String[] args) throws Exception{
        ArrayList<String> list = new ArrayList<>();

        Class<? extends ArrayList> aClass = list.getClass();
        Method add = aClass.getDeclaredMethod("add", Object.class);

        add.invoke(list,100);

        for (Object o : list) {
            System.out.println(o);
        }
    }
}
